﻿@using Seal.Model
@{
    ReportView view = Model;
    Report report = view.Report;
    Repository repository = report.Repository;
    var configuration = repository.Configuration;

    var showMessageClass = (report.ShowExecutionMessages ? "class='active'" : "");
    var showInfoClass = (string.IsNullOrEmpty(showMessageClass) && view.GetBoolValue("information_button") ? "class='active'" : "");
    var showReportClass = (string.IsNullOrEmpty(showMessageClass) && string.IsNullOrEmpty(showInfoClass) ? "class='active'" : "");
}

@if (report.GenerateHTMLDisplay || !report.PdfConversion)
{
    <nav id="bar_top" class='navbar navbar-default navbar-fixed-top' style='transition:top 0.3s;'>
        <div class="container@(view.GetBoolValue("container_fluid") ? "-fluid" : "")">
            <div class="navbar-header">
                <button type="button" data-target="#navbarCollapse" data-toggle="collapse" class="navbar-toggle">
                    <span class="sr-only">@report.Translate("Toggle navigation")</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                @if (configuration.HasLogo)
                {
                    <a href="#" class="navbar-left hidden-xs">
                        <img src="@report.AttachImageFile(configuration.LogoName)" class="img-responsive" alt="@report.ExecutionName">
                    </a>
                }
                <a id="nav_button" href="#" class="navbar-brand">@(!configuration.HasLogo ? configuration.WebProductName + " - " : "")@report.ExecutionName</a><span id="nav_badge" class="badge navbar-left hidden">@report.Translate("Nav")</span>
            </div>
            <div id="navbarCollapse" class="collapse navbar-collapse">
                @if (report.GenerateHTMLDisplay)
                {
                    <button id="execute_button" class="btn btn-success navbar-btn navbar-right">@report.Translate("Execute")</button>
                    <button id="restrictions_button" type="button" class="btn btn-info navbar-btn navbar-right" title="@report.Translate("Show/Hide Restrictions")">
                        <span class="glyphicon glyphicon-filter"></span>
                    </button>
                    }
                    @if (report.GenerateHTMLDisplay || !report.PrintLayout)
                    {
                        <ul class="nav navbar-nav navbar-right">
                            <li @Raw(showReportClass)><a id="report_button" class="sr_tab" data-toggle="tab" href="#@(view.ViewId)_div">@report.Translate("Report")</a></li>
                            <li @Raw(showInfoClass)><a id="information_button" class="sr_tab" data-toggle="tab" href="#information_div">@report.Translate("Information")</a></li>
                            @if (view.GetValue("messages_mode") != "disabled")
                            {
                                <li @Raw(showMessageClass)><a id="message_button" class="sr_tab" data-toggle="tab" href="#message_div">@report.Translate("Messages")</a></li>
                            }
                            @if (report.GenerateHTMLDisplay)
                            {
                                <li class="dropdown">
                                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                                        @report.Translate("Results")
                                        <span class="caret"></span>
                                    </a>
                                    <ul class="dropdown-menu">
                                        <li><a id="HtmlResult" class="sr_result" href="#">@report.Translate("View HTML Result")</a></li>
                                        <li><a id="PrintResult" class="sr_result" href="#">@report.Translate("View Print Result")</a></li>
                                        <li><a id="CSVResult" class="sr_result" href="#">@report.Translate("View CSV Result")</a></li>
                                        @if (view.GetBoolValue("converter_button"))
                                        {
                                            <li><a id="PDFResult" class="sr_result" href="#">@report.Translate("View PDF Result")</a></li>
                                            <li><a id="ExcelResult" class="sr_result" href="#">@report.Translate("View Excel Result")</a></li>
                                        }
                                    </ul>
                                </li>
                            }
                        </ul>
                    }
                </div>
        </div>
    </nav>
}

